package com.wwu.admin;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Description 类描述：系统启动类
 * @EnableCaching注解作用： 开启缓存
 * @EnableAsync注解作用： 开启异步注解
 * @Author 一蓑烟雨
 * @CreateTime 2021.10.13
 * @Version 1.0.0
 **/
@Slf4j
@EnableCaching
@EnableAsync
@SpringBootApplication
@MapperScan("com.wwu.*.mapper")
@ComponentScan({"com.wwu.common","com.wwu.develop", "com.wwu.system", "com.wwu.admin"})
public class YuChenApplication {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(YuChenApplication.class,args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        String minioPath = env.getProperty("minio.consoleEndpoint");
        log.info("\n----------------------------------------------------------\n\t" +
                "本项目已启动，以下为项目相关访问路径: \n\t" +
                "1.本地访问地址: \t\t http://localhost:" + port + path + "/ \n\t" +
                "2.远程访问地址: \t\t http://" + ip + ":" + port + path + "/ \n\t" +
                "3.Swagger-API地址: \t http://" + ip + ":" + port + path + "/doc.html \n\t" +
                "4.Minio控制台地址: \t " + minioPath + " \n" +
                "----------------------------------------------------------");
    }
}
